﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

using SpiritAlight.Input;
using SpiritAlight.GeneralClac;
using SpiritAlight.Stage;

namespace SpiritAlight.Character.Unit
{
    public class Army : AUnit
    {
        /// <summary>
        /// 選択中フラグ。
        /// </summary>
        public bool IsSelect
        {
            get { return isSelect; }
            protected set { isSelect = value; }
        }
        bool isSelect = false;

        public override void Initialize()
        {
            base.Initialize(); 
        }

        public override void LoadContent()
        {
            base.LoadContent();
        }

        public override void Update()
        {
            //if (inputState[Input.MouseButton.Left] == Input.DeviceState.Pressed)
            //    OnClick(inputState.GetGlobalMousePosition(GlobalCoordinate));


            base.Update();
        }

        public override void Draw()
        {
            base.Draw();
        }

        public void OnClick(Vector2 MousePosition)
        {
            Vector2 gMousePosition = Coordinate.ScreenToGlobal(MousePosition);

            if (isSelect)
                MoveStart(gMousePosition);

            isSelect = false;

        }

        public bool IsClick(Vector2 MousePosition)
        {
            Vector2 gMousePosition = Coordinate.ScreenToGlobal(MousePosition);
            if (Calc.IntersectPoint(Position, Status.Size, gMousePosition))
            {
                isSelect = true;
                return true;
            }
            else
            {
                isSelect = false;
                return false;
            }
        }

    }
}
